package com.ruoyi.system.mapper;

import java.math.BigDecimal;
import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.TUserMoneyChange;
import com.ruoyi.system.domain.dto.TUserMoneyChangeDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 用户资金变动Mapper接口
 *
 * @author ruoyi
 * @date 2024-04-16
 */
@Mapper
public interface TUserMoneyChangeMapper extends BaseMapper<TUserMoneyChange>
{
    /**
     * 查询用户资金变动
     *
     * @param id 用户资金变动主键
     * @return 用户资金变动
     */
    public TUserMoneyChange selectTUserMoneyChangeById(Long id);

    /**
     * 查询用户资金变动列表
     *
     * @param tUserMoneyChange 用户资金变动
     * @return 用户资金变动集合
     */
    public List<TUserMoneyChange> selectTUserMoneyChangeList(TUserMoneyChange tUserMoneyChange);

    /**
     * 新增用户资金变动
     *
     * @param tUserMoneyChange 用户资金变动
     * @return 结果
     */
    public int insertTUserMoneyChange(TUserMoneyChange tUserMoneyChange);

    /**
     * 修改用户资金变动
     *
     * @param tUserMoneyChange 用户资金变动
     * @return 结果
     */
    public int updateTUserMoneyChange(TUserMoneyChange tUserMoneyChange);

    /**
     * 删除用户资金变动
     *
     * @param id 用户资金变动主键
     * @return 结果
     */
    public int deleteTUserMoneyChangeById(Long id);

    /**
     * 批量删除用户资金变动
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteTUserMoneyChangeByIds(Long[] ids);

    List<TUserMoneyChange> selectByUserId(@Param("userId") Long userId, @Param("time") String time);

    BigDecimal selectByUserIdTotal(@Param("userId") Long userId);

    List<TUserMoneyChange> selectByUserAndTeam(@Param("userId") Long userId, @Param("leave") Integer leave);
    List<TUserMoneyChange> selectByUserAndTeamList(@Param("userId") Long userId, @Param("leave") Integer leave,@Param("sourceIds") List<Long> sourceIds);

    List<TUserMoneyChangeDto> getUserEarningsList(@Param("userId") Long userId,@Param("earningsType") Integer earningsType,@Param("moneyDetailType") Integer moneyDetailType);

    List<TUserMoneyChange> selectTurntableLog(@Param("userId") Long userId);
}
